let path = getDataPath();
// 用户ID
let id = getUrlParam("id");
$(function () {
  // GetUserRole();
  loadFnc();
});
//获取用户权限
function GetUserRole() {
  // let thisdata = [];
  // thisdata.push(InitRole(id));
  let USERdata = InitRole(id);
  if (USERdata != null) {
    loadFnc();
  }
  else OpenErrmsg("web/errhtml/404.html");
}
function loadFnc(params) {
  ReInitData()
}
var endtime = GetDateStr(0)
var starttime = GetDateStr(-1)
function ReInitData() {

  $('#db_Start').datebox({
    onSelect: function (date) {
      var y = date.getFullYear();//年
      var m = date.getMonth() + 1;//月
      var d = date.getDate();//日
      var ymd = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
      starttime = ymd
      if (starttime >= endtime) {
        alert('开始时间不能晚于结束时间')
        reset()
      }
    }
  });
  $('#db_End').datebox({
    onSelect: function (date) {
      var y = date.getFullYear();//年
      var m = date.getMonth() + 1;//月
      var d = date.getDate();//日
      var ymd = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
      endtime = ymd
      if (starttime >= endtime) {
        alert('开始时间不能晚于结束时间')
        reset()
      }
      // else {
      //   InitChart(endtime, starttime)
      // }
    }
  });
  $('#db_Start').datebox('setValue', GetDateStr(-1));
  $('#db_End').datebox('setValue', getCurrDate());

  InitChart(endtime, starttime)
}
function InitData() {
  InitChart(endtime, starttime)
}
function reset() {
  endtime = GetDateStr(0)
  starttime = GetDateStr(-1)
  setTimeout(() => {
    $('#db_Start').datebox('setValue', GetDateStr(-1));
    $('#db_End').datebox('setValue', getCurrDate());
  }, 1000);
  // InitChart(endtime, starttime)
}
//折线图
function InitChart(endtime, starttime) {
  let xAxis = [];
  let data1 = [];
  let data2 = [];
  let data3 = [];
  let data4 = [];
  let data5 = [];
  let data6 = [];
  let data7 = [];
  let data8 = [];
  let data9 = [];
  let data10 = [];
  let data11 = [];
  let data12 = [];
  let data13 = [];
  let data14 = [];
  let data15 = [];
  let data16 = [];
  let data17 = [];
  let data18 = [];
  let data19 = [];
  let data20 = [];
  let data21 = [];
  let data22 = [];
  let data23 = [];
  let data24 = [];
  let data25 = [];
  let data26 = [];
  let data27 = [];
  let data28 = [];
  let data29 = [];
  let data30 = [];
  let data31 = [];
  let data32 = [];
  let data33 = [];
  let data34 = [];
  let url = ''
  url = path + '/ls172/data-analysis/makeReport'
  var params = {
    "endTime": endtime,
    "startTime": starttime
  }
  $.ajax({
    url: url,
    type: "post",
    async: false,
    dataType: "json",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json"
    },
    data: JSON.stringify(params),

    success: function (data) {
      if (data.data.siren.length == 0 || data.data.other.length == 0) {
        $('#haveproblem').css("display", "none")
        $('#noproblem').css("display", "block")
      } else {
        $('#haveproblem').css("display", "block")
        $('#noproblem').css("display", "none")
      }
      data30 = data.data.threeTwo[8].vals
      xAxis = data.data.replaceAllList
      document.getElementById('numproblem').innerHTML = data.data.siren.length
      document.getElementById('equiproblem').innerHTML = data.data.other.length
      document.getElementById('maxPressureDifference1').innerHTML = data.data.statusData[1].value
      document.getElementById('maxTempDifference1').innerHTML = data.data.statusData[0].value
      document.getElementById('maxPressureDifference2').innerHTML = data.data.statusData[3].value
      document.getElementById('maxTempDifference2').innerHTML = data.data.statusData[2].value
      document.getElementById('maxPressureDifference3').innerHTML = data.data.statusData[5].value
      document.getElementById('maxTempDifference3').innerHTML = data.data.statusData[4].value
      document.getElementById('maxPressureDifference4').innerHTML = data.data.statusData[7].value
      document.getElementById('maxTempDifference4').innerHTML = data.data.statusData[6].value
      for (let i = 0; i < data.data.siren.length; i++) {
        document.getElementById('problem1fenxi').innerHTML = document.getElementById('problem1fenxi').innerHTML +
          `<div class="textcontent">（` + (i + 1) + `）`
          + data.data.siren[i].almtime + `前后，
                系统监测分析得出` + data.data.siren[i].custom0 +
          `在故障发生时明显异常变化，
                详细数据图表如下所示：
              </div>
              <div style="text-align:center;font-size:16px;line-height:40px;height:40px;">温度数据表</div>
              <div style="width: 70%;margin:0 auto;">
                <table style="margin:0 auto;">
                  <tr style="width: 100%;">
                    <th style="width: 9%;">时间</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[0].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[1].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[2].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[3].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[4].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[5].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[6].slice(11, 16) + `</th>
                  </tr>
                  <tr>
                    <th>数据</th>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[0] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[1] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[2] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[3] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[4] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[5] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[6] + `</td>
                  </tr>
                  <tr style="width: 100%;">
                    <th style="width: 9%;">时间</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[7].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[8].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[9].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[10].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[11].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[12].slice(11, 16) + `</th>
                    <th style="width: 120px"></th>
                  </tr>
                  <tr>
                    <th>数据</th>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[7] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[8] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[9] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[10] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[11] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[12] + `</td>
                    <td style="text-align: center;"></td>
                  </tr>
                </table>
              </div>
              <div style="text-align:center;font-size:16px;line-height:40px;height:40px;">压力数据表</div>
              <div style="width: 70%;margin:0 auto;">
                <table style="margin:0 auto;">
                  <tr style="width: 100%;">
                    <th style="width: 9%;">时间</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[0].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[1].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[2].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[3].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[4].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[5].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[6].slice(11, 16) + `</th>
                  </tr>
                  <tr>
                    <th>数据</th>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[0] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[1] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[2] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[3] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[4] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[5] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[6] + `</td>
                  </tr>
                  <tr style="width: 100%;">
                    <th style="width: 9%;">时间</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[7].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[8].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[9].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[10].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[11].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.sirenFormData.list[i].time[12].slice(11, 16) + `</th>
                    <th style="width: 120px"></th>
                  </tr>
                  <tr>
                    <th>数据</th>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[7] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[8] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[9] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[10] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[11] + `</td>
                    <td style="text-align: center;">`+ data.data.sirenFormData.list[i].vals[12] + `</td>
                    <td style="text-align: center;"></td>
                  </tr>
                </table>
                <div style="width:  100%;padding: 0px;">
                  <div id="Tchart`+ i + `" class="chartdiv" style="float: left;"></div>
                  <div id="Pchart`+ i + `" class="chartdiv" style="float: left;"></div>
                </div>
                <div style="display: flex;clear: both;width: 100%;">
                  <div style="width: 50%;text-align: center;">温度数据</div>
                  <div style="width: 50%;text-align: center;">压力数据</div>
                </div>
              </div>
                `
      }
      for (let i = 0; i < data.data.other.length; i++) {
        document.getElementById('problem2fenxi').innerHTML = document.getElementById('problem2fenxi').innerHTML +
          `
                <div class="textcontent">（`+ (i + 1) + `）` + data.data.other[i].almtime + `
                  时，`+ data.data.other[i].custom0 + data.data.other[i].custom1 + `对闪蒸汽压缩机组的正常运行产生严重的影响。
                </div>
                <div class="textcontent">
                  且已根据系统诊断结果对闪蒸汽压缩机组的故障进行处理，确保机组恢复正常的运行状态。
                </div>
                <div class="textcontent">
                  系统监测分析得出二级压缩机B出口温度数据、压力数据在故障发生时明显异常变化，详细数据图表如下所示：
                </div>
                <div style="text-align:center;font-size:16px;line-height:40px;height:40px;">温度数据表</div>
                <div style="width: 70%;margin:0 auto;">
                  <table style="margin:0 auto;">
                    <tr style="width: 100%;">
                      <th style="width: 9%;">时间</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[0].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[1].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[2].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[3].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[4].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[5].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[6].slice(11, 16) + `</th>
                    </tr>
                    <tr>
                      <th>数据</th>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[0] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[1] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[2] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[3] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[4] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[5] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[6] + `</td>
                    </tr>
                    <tr style="width: 100%;">
                    <th style="width: 9%;">时间</th>
                    <th style="width: 120px">`+ data.data.otherFormData.list[i].time[7].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.otherFormData.list[i].time[8].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.otherFormData.list[i].time[9].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.otherFormData.list[i].time[10].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.otherFormData.list[i].time[11].slice(11, 16) + `</th>
                    <th style="width: 120px">`+ data.data.otherFormData.list[i].time[12].slice(11, 16) + `</th>
                    <th style="width: 120px"></th>
                    </tr>
                    <tr>
                      <th>数据</th>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[7] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[8] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[9] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[10] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[11] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[12] + `</td>
                      <td style="text-align: center;"></td>
                    </tr>
                  </table>
                </div>
                <div style="text-align:center;font-size:16px;line-height:40px;height:40px;">压力数据表</div>
                <div style="width: 70%;margin:0 auto;">
                  <table style="margin:0 auto;">
                    <tr style="width: 100%;">
                      <th style="width: 9%;">时间</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[0].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[1].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[2].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[3].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[4].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[5].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[6].slice(11, 16) + `</th>
                    </tr>
                    <tr>
                      <th>数据</th>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[0] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[1] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[2] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[3] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[4] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[5] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[6] + `</td>
                    </tr>
                    <tr style="width: 100%;">
                      <th style="width: 9%;">时间</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[7].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[8].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[9].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[10].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[11].slice(11, 16) + `</th>
                      <th style="width: 120px">`+ data.data.otherFormData.list[i].time[12].slice(11, 16) + `</th>
                      <th style="width: 120px"></th>
                    </tr>
                    <tr>
                      <th>数据</th>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[7] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[8] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[9] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[10] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[11] + `</td>
                      <td style="text-align: center;">`+ data.data.otherFormData.list[i].vals[12] + `</td>
                      <td style="text-align: center;"></td>
                    </tr>
                  </table>
                  <div style="width:  100%;padding: 0px;">
                    <div id="Tchartdiv`+ i + `" class="chartdiv" style="float: left;"></div>
                    <div id="Pchartdiv`+ i + `" class="chartdiv" style="float: left;"></div>
                  </div>
                  <div style="display: flex;clear: both;width: 100%;">
                    <div style="width: 50%;text-align: center;">温度数据</div>
                    <div style="width: 50%;text-align: center;">压力数据</div>
                  </div>
                `

      }
      for (let i = 0; i < data.data.siren.length; i++) {
        createChart("Tchart" + i, data.data.sirenFormData.list[i].time, data.data.sirenFormData.list[i].vals, "");
        createChart("Pchart" + i, data.data.sirenFormData.list[i].time, data.data.sirenFormData.list[i].vals, "");
      }
      for (let i = 0; i < data.data.other.length; i++) {
        createChart("Tchartdiv" + i, data.data.sirenFormData.list[i].time, data.data.sirenFormData.list[i].vals, "");
        createChart("Pchartdiv" + i, data.data.sirenFormData.list[i].time, data.data.sirenFormData.list[i].vals, "");
      }
      data1 = data.data.one[0].vals
      data2 = data.data.one[2].vals
      data3 = data.data.one[1].vals
      data4 = data.data.one[7].vals
      data5 = data.data.one[5].vals
      data6 = data.data.one[10].vals
      data7 = data.data.one[8].vals
      data8 = data.data.one[12].vals
      data9 = data.data.two[0].vals
      data10 = data.data.two[2].vals
      data11 = data.data.two[1].vals
      data12 = data.data.two[7].vals
      data13 = data.data.two[5].vals
      data14 = data.data.two[10].vals
      data15 = data.data.two[8].vals
      data16 = data.data.two[12].vals
      data17 = data.data.threeOne[0].vals
      data18 = data.data.threeOne[2].vals
      data19 = data.data.threeOne[1].vals
      data20 = data.data.threeOne[7].vals
      data21 = data.data.threeOne[5].vals
      data22 = data.data.threeOne[10].vals
      data23 = data.data.threeOne[8].vals
      data24 = data.data.threeTwo[0].vals
      data25 = data.data.threeTwo[2].vals
      data26 = data.data.threeTwo[1].vals
      data27 = data.data.threeTwo[7].vals
      data28 = data.data.threeTwo[5].vals
      data29 = data.data.threeTwo[10].vals
      data30 = data.data.threeTwo[8].vals
      createChart("chartdiv1", xAxis, data1, "一级压缩机入口温度 ");
      createChart("chartdiv2", xAxis, data2, "一级压缩机A出口压力");
      createChart("chartdiv3", xAxis, data3, "一级压缩机A出口温度");
      createChart("chartdiv4", xAxis, data4, "一级压缩机B出口压力");
      createChart("chartdiv5", xAxis, data5, "一级压缩机B出口温度");
      createChart("chartdiv6", xAxis, data6, "一级洗涤器压力");
      createChart("chartdiv7", xAxis, data7, "一级洗涤器液位");
      createChart("chartdiv8", xAxis, data8, "一级后冷却器出口温度");
      createChart("chartdiv9", xAxis, data9, "二级压缩机入口温度");
      createChart("chartdiv10", xAxis, data10, "二级压缩机A出口压力");
      createChart("chartdiv11", xAxis, data11, "二级压缩机A出口温度");
      createChart("chartdiv12", xAxis, data12, "二级压缩机B出口压力");
      createChart("chartdiv13", xAxis, data13, "二级压缩机B出口温度");
      createChart("chartdiv14", xAxis, data14, "二级洗涤器压力");
      createChart("chartdiv15", xAxis, data15, "二级洗涤器液位");
      createChart("chartdiv16", xAxis, data16, "二级后冷却器出口温度");
      createChart("chartdiv17", xAxis, data17, "三级第一压缩机入口温度");
      createChart("chartdiv18", xAxis, data18, "三级第一压缩机A出口压力");
      createChart("chartdiv19", xAxis, data19, "三级第一压缩机A出口温度");
      createChart("chartdiv20", xAxis, data20, "三级第一压缩机B出口压力");
      createChart("chartdiv21", xAxis, data21, "三级第一压缩机B出口温度");
      createChart("chartdiv22", xAxis, data22, "三级第一洗涤器压力");
      createChart("chartdiv23", xAxis, data23, "三级第一洗涤器液位");
      createChart("chartdiv24", xAxis, data24, "三级第二压缩机入口温度");
      createChart("chartdiv25", xAxis, data25, "三级第二压缩机A出口压力");
      createChart("chartdiv26", xAxis, data26, "三级第二压缩机A出口温度");
      createChart("chartdiv27", xAxis, data27, "三级第二压缩机B出口压力");
      createChart("chartdiv28", xAxis, data28, "三级第二压缩机B出口温度");
      createChart("chartdiv29", xAxis, data29, "三级第二洗涤器压力");
      createChart("chartdiv30", xAxis, data30, "三级第二洗涤器液位");
      let yuzhidata = data.data.siren
      let guzhangdata = data.data.other
      $('#dg_DateList1').datagrid({
        data: {
          "total": yuzhidata.length, "rows": yuzhidata
        }
      });
      $('#dg_DateList2').datagrid({
        data: {
          "total": guzhangdata.length, "rows": guzhangdata
        }
      });
    },
    error: function (data) {
      console.log("code", data);
    }
  });
}

function createChart(id, xAxis, data, title) {
  let myChart = echarts.init(document.getElementById(id));
  let xAxisDataLine = new Array();
  for (let i = 0; i < data.length; i++) {
    if (data[i] == '-9999') {
      data[i] = '0'
    }
  }
  // console.log(xAxisDataLine)
  // 指定图表的配置项和数据
  let option = {
    title: {
      text: title,
      padding: 15,
      textStyle: {
        fontSize: 12,
        color: '#333'          // 主标题文字颜色
      },
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: xAxisDataLine,

    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    toolbox: {
      // feature: {
      //     saveAsImage: {}
      // }
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: xAxis
    },
    yAxis: {
      type: 'value'
    },
    series: {
      data: data,
      type: 'line'
    },
    axisLabel: {
      interval: 0, //坐标刻度之间的显示间隔，默认就可以了（默认是不重叠）
      rotate: 38   //调整数值改变倾斜的幅度（范围-90到90）
    }
  };
  // 使用刚指定的配置项和数据显示图表。
  myChart.setOption(option);
}
